From 8d951476bfc7c3886c383796f2c7a67141fe11cc Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 23 Nov 2010 17:00:20 -0500 Subject: [PATCH] Add an activity example This doesn't work, since it trips up on num-steps not being available for GtkEventBox. --- tests/styleexamples.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/styleexamples.c b/tests/styleexamples.c index c43336f4f6..248ca645dd 100644 --- a/tests/styleexamples.c +++ b/tests/styleexamples.c @@ -172,6 +172,27 @@ draw_cb_frame (GtkWidget *widget, cairo_t *cr) return TRUE; } +/* FIXME: this doesn't work */ +static gboolean +draw_cb_activity (GtkWidget *widget, cairo_t *cr) +{ + GtkStyleContext *context; + + context = gtk_widget_get_style_context (widget); + gtk_style_context_save (context); + + gtk_style_context_add_class (context, "spinner"); + gtk_style_context_set_state (context, 0); + gtk_render_activity (context, cr, 12, 12, 12, 12); + gtk_style_context_set_state (context, GTK_STATE_FLAG_INSENSITIVE); + gtk_render_activity (context, cr, 36, 12, 12, 12); + + gtk_style_context_restore (context); + + return TRUE; +} + + static char *what; static gboolean @@ -189,6 +210,8 @@ draw_cb (GtkWidget *widget, cairo_t *cr) return draw_cb_background (widget, cr); else if (strcmp (what, "frame") == 0) return draw_cb_frame (widget, cr); + else if (strcmp (what, "activity") == 0) + return draw_cb_activity (widget, cr); return FALSE; } -- 2.30.2